#ifndef TYPE_HELPER_H
#define TYPE_HELPER_H
#include <boost/any.hpp>
#include <string>
namespace vpm 
{
	namespace utils
	{
		namespace detail
		{
/*
   this is a helper class for convert the char * to string or string to char * 
*/
template<class T>
class TypeSetter
{
	public:
		const T &operator()(const T & _ref)
		{
			return _ref; 
		}
};
template<>
class TypeSetter<char *>
{
	public:
		const std::string   operator()(char * &value )
		{
			return std::string(value); 
		}

};
template<>
class TypeSetter<const char *>
{
	public:
		const std::string  operator()(const char *& value)
		{
			return std::string(value); 
		}
};

template<class T>
class TypeGetter
{
	public:
		T& operator()( boost::any &_ref) const 
		{
			return boost::any_cast<T&>(_ref); 
		}

};

template<>
class TypeGetter<const char *>
{
	public:
		const char * operator()(boost::any &_ref) const 
		{
			return (boost::any_cast<const std::string&>(_ref)).c_str(); 
		}
};

template<>
class TypeGetter<char *>
{
	public:
		char * operator()(boost::any & _ref) const 
		{
			return const_cast<char*> ((boost::any_cast<const std::string&>(_ref)).c_str()); 
		}
};


template <int t>
struct KeyTraitType
{
	enum { traitType = 	t };
};

typedef KeyTraitType<false>  STRING_KEY;
typedef KeyTraitType<true>   INTEGRAL_KEY;

		}
	}
}


#endif // 
